<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>7-量词符</title>
</head>
<body>
    <script>
        //1.匹配a开头，a结尾的
        var reg1 = /^a$/;
        console.log(reg1.test('a'));//true
        console.log('----------@2---------------');
        //2.a出现0次或多次*
        var reg2 = /^a*$/;
        console.log(reg2.test(''));//true
        console.log(reg2.test('aa'));//true
        console.log('----------@3---------------');
        //3.a重复一次或更多次+
        var reg3 = /^a+$/;
        console.log(reg3.test('aa'));//true
        console.log(reg3.test('aaaaaa'));//true
        console.log('----------@4---------------');
        //4.a重复3次
        var reg4 = /^a{3}$/;
        console.log(reg4.test('aaa'));//true
        console.log(reg4.test('aa'));//false
        //5.a在[3,10]区间 >=3且<=10
        console.log('----------@5---------------');
        var reg5 = /^a{3,10}$/;
        console.log(reg5.test('aaa'));//true
        console.log(reg5.test('aaaa'));//true
        console.log(reg5.test('aa'));//false
    </script>
</body>
</html>